<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>vue1</title>
        <script src="js/vue.js"></script>
        <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    </head>
    <body>
        <div id="app">
            <input type="button" value="获取一个笑话" @click="getJoke()">
            <p>{{ joke }}</p>
        </div>
        <script>
            /*
            接口： https://autumnfish.cn/api/joke
            get
            */ 
            let vue = new Vue({
        // 告诉vue的实例对象，将来需要控制界面上的那个区域
                el:'#app',
                data:{
                    joke:"很好笑的笑话"
                },
                methods: {
                    getJoke(){
                        var that = this;
                        axios.get("https://autumnfish.cn/api/joke").then(function(response){

                            console.log(response)
                            that.joke = response.data
                        },function(err){

                        })
                    }
                },
            });
        </script>
    </body>
</html>